function go(){
	function getNode(node){
		var nodeExpr=node.tagName;
		if(nodeExpr==null)
			return null;
		if(node.id!=''){
			nodeExpr+=&quot;[@id='&quot;+node.id+&quot;']&quot;;
			return &quot;/&quot;+nodeExpr;
		}
		var rank=1;
		var ps=node.previousSibling;
		while(ps!=null){
			if(ps.tagName==node.tagName){
				rank++;
			}
			ps=ps.previousSibling;
		}
		if(rank>1){
			nodeExpr+='['+rank+']';
		} else {
			var ns=node.nextSibling;
			while(ns!=null){
				if(ns.tagName==node.tagName){
					nodeExpr+='[1]';
					break;
				}
				ns=ns.nextSibling;
			}
		}
		return nodeExpr;
	}
	
	var currentNode=window.getSelection().anchorNode;
	if(currentNode==null){
		alert(&quot;No selection&quot;);
		return;
	}
	var path=[];
	while(currentNode!=undefined){
		var pe=getNode(currentNode);
		if(pe!=null){
			path.push(pe);
			if(pe.indexOf('@id')!=-1)
				break;
		}
		currentNode=currentNode.parentNode;
	}
	var xpath=&quot;/&quot;+path.reverse().join('/');
	alert(xpath +' was bookmarked for user X!');
}
go();